package cn.kgc.novel.utils;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller
public class SendEmail {

    @Resource
    private  JavaMailSender mailSender;
    @Async
    public  void sendSimpleEmail(String email,String subject, String text){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("15175032759@163.com");
        message.setTo(email);
        message.setSubject(subject);
        message.setText(text);
        mailSender.send(message);
    }
}
